package com.lagou.app;

import com.lagou.dao.UserDao;
import com.lagou.entity.User;
import com.lagou.utils.DateUtils;
import com.lagou.utils.UUIDUtils;
import org.junit.Test;

import javax.sql.DataSource;
import java.sql.SQLException;

public class TestUserDao {

    UserDao userDao = new UserDao();
    @Test
    public void testRegister() throws SQLException {
        User user = new User();
        user.setUid(UUIDUtils.getUUID());
        user.setUsername("吴松");
        user.setPassword("123456");
        user.setTelephone("13966678921");
        user.setBirthday(DateUtils.getDateFormart());

        int register = userDao.register(user);

        if(register>0){
            System.out.println("注册成功:"+user.getUsername());
        }else {
            System.out.println("注册失败");
        }
    }
    @Test
    public void Tsetlogin() throws SQLException {
        User user = userDao.login("吴松","123456");
        if(user!=null){
            System.out.println("欢迎您!"+ user.getUsername());
        }else{
            System.out.println("登陆失败");
        }
    }

}
